/* Copyright (c) 2025 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *          http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#ifndef __CAPABILITY_H__
#define __CAPABILITY_H__

#include "common.h"
#include "industry_standard/spdm.h"
#include "library/spdm_common_lib.h"

// SPDM请求者capabilities，当前支持到get_digest、get_certificate、challenge_auth和heartbeat
#define CAPABILITY_FLAG ( \
    SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CERT_CAP | \
    SPDM_GET_CAPABILITIES_REQUEST_FLAGS_CHAL_CAP | \
    SPDM_GET_CAPABILITIES_REQUEST_FLAGS_HBEAT_CAP)

// 度量标准，当前仅DMTF
#define MEASUREMENT_SPEC SPDM_MEASUREMENT_SPECIFICATION_DMTF

// 非对称加密算法，支持RSAPSS2048、RSAPSS3072、RSAPSS4096
#define ASYM_ALGO ( \
    SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_2048 | \
    SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_3072 | \
    SPDM_ALGORITHMS_BASE_ASYM_ALGO_TPM_ALG_RSAPSS_4096)

// 哈希算法，支持SHA256、SHA384、SHA512
#define HASH_ALGO ( \
    SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_256 | \
    SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_384 | \
    SPDM_ALGORITHMS_BASE_HASH_ALGO_TPM_ALG_SHA_512)

string GetCapabilityString(const string& cap_type, uint32_t cap);

#endif // __CAPABILITY_H__